import React, { useEffect, useRef } from 'react';

const Child = (props) => {
  const myRef = useRef(null);

  const { cb } = props;

  useEffect(() => {
    cb(myRef);

    return () => {};
  }, [cb]);

  return (
    <div style={{ backgroundColor: 'yellow', padding: '5px' }}>
      <input
        type="text"
        ref={myRef}
        defaultValue="1111"
      />
    </div>
  );
};

export default Child;
